<style>
    .code{
        position:relative;
        top:-4px;
    }
</style>
<div class="content">
    <div class="header">
        <h1 class="page-title">添加优惠码</h1>
    </div>
    <ul class="breadcrumb">
        <!--<li><a href="index.html">Home</a> <span class="divider">/</span></li>-->
        <!--<li class="active">发布文章</li>-->
    </ul>

    <div class="container-fluid">
        <div class="row-fluid">

            <div class="btn-toolbar">
                <button class="btn btn-primary" onClick="location='<?php echo url('Admin/Index/code_list'); ?>'"><i class="icon-list"></i> 优惠码列表</button>
                <div class="btn-group">
                </div>
            </div>
            <div class="well">
                <div id="myTabContent" class="tab-content">
                    <div class="tab-pane active in" id="home">
                        <form action="" method="post">
                            <label>优惠码</label>
                            <input type="text" id="code" name="co_code" value="" class="input-xxlarge"> <input class="btn btn-primary code" type="button" value="随机生成" />
                            <label></label>
                            <input class="btn btn-primary" type="submit" value="提交" />
                        </form>
                    </div>
                </div>
            </div>

            <div class="modal small hide fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
                    <h3 id="myModalLabel">Delete Confirmation</h3>
                </div>
                <div class="modal-body">

                    <p class="error-text"><i class="icon-warning-sign modal-icon"></i>Are you sure you want to delete the user?</p>
                </div>
                <script language="javascript">
                    function randomString(len) {
                        len = len || 32;
                        var $chars = 'ABCDEFGHJKMNPQRSTWXYZabcdefhijkmnprstwxyz2345678';    /****默认去掉了容易混淆的字符oOLl,9gq,Vv,Uu,I1****/
                        var maxPos = $chars.length;
                        var pwd = '';
                        for (i = 0; i < len; i++) {
                            pwd += $chars.charAt(Math.floor(Math.random() * maxPos));
                        }
                        return pwd;
                    }
                    $('.code').click(function (e){
                        $('#code').val(randomString(32))
                    })

                </script>